<template>
  <div class="header">
    <div class="l">
      <img src="../assets/images/indexLogo.6f8ac4f0.png" alt="" />
    </div>
    <ul class="c">
      <li :class="{active:$route.path=='/home'}" @click="$router.push('/home')">首页</li>
      <li :class="{active:$route.path=='/goods'}" @click="$router.push('/goods')">全部商品</li>
      <li :class="{active:$route.path=='/user'}" @click="$router.push('/user')">个人中心</li>
      <li :class="{active:$route.path=='/order'}" @click="$router.push('/order')">我的订单</li>
      <li :class="{active:$route.path=='/free'}" @click="$router.push('/free')">专属福利</li>
    </ul>
    <div class="r">
      <input type="text" value="输入关键字 " v-model="userInputSearch" /><button @click="toSearch()">
        <img src="../assets/images/search.png" alt="" />
      </button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userInputSearch:''
    };
  },
  methods:{
    toSearch(){
      this.$router.push(`/goods?keyword=${this.userInputSearch}`)
      this.userInputSearch=""
    }
  }
};
</script>
 
<style lang = "less" scoped>
.header {
  margin: 0 auto;
  width: 1200px;
  height: 118px;
  display: flex;
  justify-content: space-between;
  .l {
    margin-top: 14px;
  }
  .c {
      .active{
          color: #0a328e;
          font-weight: 700;
      }
    width: 500px;
    height: 16px;
    font-size: 16px;
    font-family: SourceHanSansSC;
    font-weight: 500;
    margin-top: 59px;
    /* color: #0a328e; */
    line-height: 23px;
    display: flex;
    justify-content: space-between;
  }
  .r {
    margin-top: 45px;
    display: flex;
    input {
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      text-indent: 20px;
      outline: none;
    }
    button {
      width: 50px;
      height: 43px;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;
      border: none;
    }
  }
}
</style>